// 导入request.js请求工具
import request from '@/utils/request.js'

// ================== 用户基础接口 ==================
// 注册
export const userRegisterService = (registerData) => {
  return request.post('/user/register', registerData) // 直接传递JSON对象
}

// 登录
export const userLoginService = (loginData) => {
  return request.post('/user/login', loginData) // 直接传递JSON对象
}

// ================== 验证码通用接口 ==================

export const sendVerificationCodeService = (data) => {
  return request.post('/user/send-code', data)
}

export const verifyCodeService = (data) => {
  return request.post('/user/verify-code', data)
}

// ================== 密码相关接口 ==================
// 更新密码（重置密码用）
export const updatePasswordService = (data) => {
  return request.post('/user/update-password', data)
}

// 用户中心
export const getUserInfoService = () => {
  return request.get('/user/info')
}

export const updateUserInfoService = (userData) => {
  return request.put('/user/update-info', userData)
}

export const userLogoutService = () => {
  return request.post('/user/logout')
}